package com.twu.biblioteca.service;

import com.twu.biblioteca.core.Book;

import java.util.ArrayList;
import java.util.List;

public class BookService {
    private List<Book> books = new ArrayList<>();

    public void addBook(Book book) {
        books.add(book);
    }

    public List<Book> getBooks() {
        return books;
    }

    public boolean reserveBook(int bookIndex) {
        try {
            books.get(bookIndex);
            return true;
        } catch (Exception e) {
            return false;
        }
    }
}
